#include <WinTen.h>
#include <Windows.h>
#include <ClipApi.h>

static BOOL bRunning;
static HWND hWndApp;

WORD wEnd;

//----------------------------------------------------------------------------//

CLIPPER WinRun()
{
   MSG msg;

   bRunning = TRUE;
   hWndApp  = _parni( 1 );

   while( GetMessage( &msg, 0, 0, 0 ) )
   {
      TranslateMessage( &msg );
      DispatchMessage( &msg );
   }
   wEnd = msg.wParam;

   bRunning = FALSE;
   hWndApp  = 0;
}

//----------------------------------------------------------------------------//

CLIPPER lWRunning() { _retl( bRunning ); }

BOOL bWRunning() { return bRunning; }

WORD GetWndApp( void ) { return hWndApp; }

CLIPPER GETWNDAPP() { _retni( GetWndApp() ); }

//----------------------------------------------------------------------------//
